#include <iostream>
#include <algorithm>
#include <string>
#include <set>
//#define int unsigned long long
#define int long long
#define all(x) x.begin(), x.end()
using namespace std;

void solve()
{
	int n, m; cin >> n >> m;
	string str; cin >> str;
	set<int> arr;
	for (int i = 0; i < m; ++i)
	{
		int tmp; cin >> tmp;
		arr.insert(tmp);
	}
	//for (int t = 0; t < n; ++t)
	//{
	//	int cur = 1;
	//	for (int i = 0; i <= t; ++i)
	//		if (str[i] == 'A') ++cur;
	//		else while (arr.count(++cur));
	//	arr.insert(cur);
	//}
	for (int t = 0, i = 0, cur = 1; t < n; ++t)
	{
		if (str[i] == 'A') ++cur, ++i;
		else while (arr.count(++cur));
		if (i < t)
		{
			++i;
			if (str[i] == 'A') ++cur, ++i;
			else while (arr.count(++cur));
		}
		arr.insert(cur);
		//for (auto& e : arr) cout << e << ' '; cout << endl;

	}
	cout << arr.size() << endl;
	for (auto& e : arr) cout << e << ' '; cout << endl;
}

signed main()
{
	int t; cin >> t;
	while (t--) solve();
	return 0;
}

//BAB
//0 1 0 0 1
//0 1 1 0 1
//0 1 1 0 1
//0 1 1 0 1 1

//ABA
//1 0 0 1 0 0 0 0 1 1
//1 1 0 1 0 0 0 0 1 1
//1 1 1 1 0 0 0 0 1 1
//1 1 1 1 0 1 0 0 1 1

//ABABB
//1 0 0 0 0 0 1
//1 1 0 0 0 0 1
//1 1 1 0 0 0 1
//1 1 1 0 1 0 1
//1 1 1 0 1 1 1
//1 1 1 0 1 1 1 0 1

//BBA
//0 0 0 0 0 1
//0 1 0 0 0 1
//0 1 0 1 0 1
//0 1 0 1 0 1

//5 3 2 BAB 2 5 3 4 ABA 1 4 9 10 5 2 ABABB 1 7 3 1 BBA 6 1 4 A 1 3 4 1000000000
//4
//2 3 5 6
//7
//1 2 3 4 6 9 10
//7
//1 2 3 5 6 7 9
//3
//2 4 6
//5
//1 2 3 4 1000000000
